New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(core): more detailed error message when version cannot be found #3424
Conversation
5545d79
to
a2d11f1
Compare
- added separate error message if version cannot be found - distinguish btw. no lerna.json not availble and invalid lerna.json
a2d11f1
to
0e780bb
Compare
@JamesHenry any chance that the fix will make it to main? Thx for having a look! |
@@ -66,6 +66,7 @@ class Project { | |||
// No need to distinguish between missing and empty, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Obviously I can't speak to the intent behind this comment originally, but your change does make it seem a little nonsensical, given you are adding an isEmpty
right below a comment saying "no need to distinguish between missing and empty".
We could probably just amend the this.configNotFound
assignment to check for Object.keys(loaded.config ?? {}).length === 0
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right that is a little bit weird. For this case i think I need to distinguish btw. emtpy and notFound because in case of empty the error message of no lerna version should appear.
The comment is related to the following line assigning an emtpy object to config. This make completly sense there because doing this avoids nasty if checks. I changed the flag from empty to noConfigFound and return it in the config. Hope this makes it a little bit less nonsensical and understandable. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
7721f65
to
7b95b57
Compare
7b95b57
to
dbd869c
Compare
Thanks @amorscher! |
When running a lerna command and no version is present in lerna.json configuration following error message is printed:
As described in (#3311) this is not completely correct.
Description
Addtional check is added during command validation to prove a version is available in lerna.json file. In addition the check for having a lerna configuration (lerna.json) available is adapted to really check for existance of the config file. This is achieved by setting an additional flag configNotFound in the project object during lerna.json retrival.
Motivation and Context
Improve error messages for invalid lerna.json to support user finding configuration problems.
The issue is described here (#3311).
How Has This Been Tested?
Added a unit test.
Manually built a lerna version.
Types of changes
Checklist: